Ext.define('truckplanner.view.mission.Calendar', {
    extend: 'Extensible.calendar.CalendarPanel',
    
    alias : 'widget.missioncalendar',
    
    title : 'Calendrier des missions',
    
    activeItem: 1, // default to week view
    
    requires: ['Extensible.calendar.data.EventMappings','Extensible.calendar.data.EventModel'],
    
    showDayView: false,
    showMonthView: false,
    showMultiWeekView: false,
    
    readOnly : true,
    
    weekViewCfg: {
    	viewStartHour : 6,
    	dayCount: 3
    },
    
    initComponent: function() {
    	var M = Extensible.calendar.data.EventMappings;
    	M.StartDate.dateFormat='Y-m-dTH:i:s';
    	M.EndDate.dateFormat='Y-m-dTH:i:s';
    	M.CalendarId.name ='CalendarId';
    	M.CalendarId.mapping ='CalendarId';
    	M.EventId.name ='id';
    	M.EventId.mapping ='id';
    	Extensible.calendar.data.EventModel.reconfigure();
    	var N = Extensible.calendar.data.CalendarMappings;
    	N.ColorId.name = 'color';
    	N.ColorId.mapping = 'color';
    	N.Title.name = 'title';
    	N.Title.mapping = 'title';
    	Extensible.calendar.data.CalendarModel.reconfigure();
    	this.eventStore = Ext.data.StoreManager.lookup('Missions');
    	this.calendarStore = new Ext.data.SimpleStore({
							        fields: ['id', 'title','color'],
							        data: [[1, 'Camion',2], [2,'Camion & Remorque',22], 
							            [3, 'Camionette',26]],
							        autoLoad: false
							    });
    	this.calendarStore.load();

    	/*truckplanner.view.mission.Calendar.prototype.fireEvent = 
		    Ext.Function.createInterceptor(function() {
 		       console.log(this.name);
		       console.log(arguments);
		       return true;
		});*/

    	this.callParent(arguments);
    }
    
});